5c82773fae316413acf58de2f666ba523f704cd5,portal-impl/src/com/liferay/portal/tools/PluginsSummaryBuilder.java,PluginsSummaryBuilder,_createPluginSummary,#String#StringBundler#,103
Before Change
sb.append("</type>\n");
sb.append("\t\t<tags>");
sb.append(tags);
sb.append("</tags>\n");
sb.append("\t\t<short-description>");
sb.append(shortDescription);
sb.append("</short-description>\n");
sb.append("\t\t<change-log>");
sb.append(changeLog);
sb.append("</change-log>\n");
sb.append("\t\t<page-url>");
sb.append(pageURL);
sb.append("</page-url>\n");
sb.append("\t\t<author>");
sb.append(author);
sb.append("</author>\n");
sb.append("\t\t<licenses>");
sb.append(licenses);
sb.append("</licenses>\n");
sb.append("\t</plugin>\n");
}
After Change
FileUtil.write(_pluginsDir + "/summary.xml", sb.toString());
}
private void _createPluginSummary(String fileName, StringBundler sb)
throws Exception {
String content = FileUtil.read(fileName);
int x = fileName.indexOf(StringPool.SLASH);
String type = fileName.substring(0, x);
if (type.endsWith("s")) {
type = type.substring(0, type.length() - 1);
}
x = fileName.indexOf(StringPool.SLASH, x) + 1;
int y = fileName.indexOf(StringPool.SLASH, x);
String artifactId = fileName.substring(x, y);
String name = StringPool.BLANK;
String tags = StringPool.BLANK;
String shortDescription = StringPool.BLANK;
String changeLog = StringPool.BLANK;
String pageURL = StringPool.BLANK;
String author = StringPool.BLANK;
String licenses = StringPool.BLANK;
if (fileName.endsWith(".properties")) {
Properties properties = PropertiesUtil.load(content);
name = _readProperty(properties, "name");
tags = _readProperty(properties, "tags");
shortDescription = _readProperty(properties, "short-description");
changeLog = _readProperty(properties, "change-log");
pageURL = _readProperty(properties, "page-url");
author = _readProperty(properties, "author");
licenses = _readProperty(properties, "licenses");
}
else {
Document document = SAXReaderUtil.read(content);
Element rootElement = document.getRootElement();
name = rootElement.elementText("name");
tags = _readList(rootElement.element("tags"), "tag");
shortDescription = rootElement.elementText("short-description");
changeLog = rootElement.elementText("change-log");
pageURL = rootElement.elementText("page-url");
author = rootElement.elementText("author");
licenses = _readList(rootElement.element("licenses"), "license");
}
_distinctAuthors.add(author);
_distinctLicenses.add(licenses);
sb.append("\t<plugin>\n");
_writeElement(sb, "artifact-id", artifactId, 2);
_writeElement(sb, "name", name, 2);
_writeElement(sb, "type", type, 2);
_writeElement(sb, "tags", tags, 2);
_writeElement(sb, "short-description", shortDescription, 2);
_writeElement(sb, "change-log", changeLog, 2);
_writeElement(sb, "page-url", pageURL, 2);
_writeElement(sb, "author", author, 2);
_writeElement(sb, "licenses", licenses, 2);
sb.append("\t\t<releng>\n");
sb.append(_readReleng(fileName));